package com.lt.lumentracks.entity.vo.common;

import lombok.Data;

/**
 * 响应结果
 *
 * @author 86178
 * @since 2025-03-13 17:11:48
 */
@Data
public class Result<T> {

    private Integer code;
    private String msg;
    private T data;


    public Result() {
    }

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    // 成功
    public static <T> Result<T> success() {
        return new Result<>(1, "suc", null);
    }
    public static <T> Result<T> success(T data) {
        return new Result<>(1, "suc", data);
    }
    public static <T> Result<T> success(String msg, T data) {
        return new Result<>(1, msg, data);
    }

    // 失败
    public static <T> Result<T> error(String msg) {
        return new Result<>(0, msg);
    }



}
